package ${location}.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ${author}
 */
@Slf4j
@Component
@WebFilter("/*")
public class CustomizeFilter implements Filter {
	/**
	 * 路径匹配器对象
	 */
	private static final AntPathMatcher MATCHER = new AntPathMatcher();

	/**
	 * 自行编辑拦截或放行逻辑
	 *
	 * @param servletRequest
	 * @param servletResponse
	 * @param filterChain
	 * @throws IOException
	 * @throws ServletException
	 */
	@Override
	public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
		HttpServletResponse response = (HttpServletResponse) servletResponse;
		response.setContentType("text/json; charset=UTF-8");
		HttpServletRequest request = (HttpServletRequest) servletRequest;
		filterChain.doFilter(request,response);
	}
}
